#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;

void test0(){
    //无参构造
    /* vector<int> vec; */
    //count value
    /* vector<int> vec(10); */
    /* vector<int> vec(10,2); */
    //迭代器范围
    int arr[10] = {1,2,3,4,5,6,7,8,9,10};
    vector<int> vec(arr,arr + 10);
    //大括号
    /* vector<int> vec = {1,2,3,4}; */
    //拷贝构造或移动构造
    
    vec.push_back(11);

    //遍历
    //下标
    for(size_t idx = 0;idx != vec.size();++idx){
        cout << vec[idx] << " ";
    }
    cout << endl;
    //未初始化的迭代器
    vector<int>::iterator it;
    for(it = vec.begin();it != vec.end();++it){
        cout << *it << " ";
    }
    cout << endl;

    vec.pop_back();

    //初始化的迭代器
    vector<int>::iterator it2 = vec.begin();
    for(;it2 != vec.end();++it2){
        cout << *it2 << " ";
    }
    cout << endl;
    //增强for循环
    for(auto & elem : vec){
        cout << elem << " ";
    }
    cout << endl;

}

int main(int argc, char * argv[])
{
    test0();
    return 0;
}


